﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Toulr.Util.Ioc;
using Toulr.Services;
using Toulr.Util.Security;
using Toulr.Models;

public partial class Account_VerifyCode : CommPageBase
{
    protected void Page_Load(object sender, EventArgs e)
    {
        IApplicationContextService iApp = UnityHelper.GetInstance<IApplicationContextService>();
        ActionResult<VerifyImage> result = iApp.GetVerifyCode();
        Session[PageHelper.KEY_VERIFYCODE] = result.Result.Code;
        System.IO.MemoryStream ms = new System.IO.MemoryStream();
        result.Result.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
        Response.ClearContent();
        Response.ContentType = "image/PNG";
        Response.BinaryWrite(ms.ToArray());
        ms.Close();
        
        result.Result.Image.Dispose();
    }
}